package com.lebang.service.sys;

import com.lebang.domain.AppLookRecord;
import com.lebang.example.AppLookRecordExample;
import com.lebang.mapper.AppLookRecordMapper;
import com.lebang.model.Whether;
import com.lebang.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 浏览任务白名单
* @Author hwq
* @Date 2020-03-30
*/
@Service
public class AppLookRecordService extends BaseService<AppLookRecord, Integer, AppLookRecordExample>{
@Autowired
private AppLookRecordMapper appLookRecordMapper;
    public boolean check(AppLookRecord record) {
        AppLookRecord record1=appLookRecordMapper.checkByUnineKeyAndSdkKey(record.getUnineKey(),record.getSdkKey());
        if(record1==null){
            appLookRecordMapper.insertSelective(record);
            return false;
        }else {
            return record1.getEnable().equals(Whether.YES.getDbIndex());
        }

    }

    public int confirm(List<String> list) {
        return appLookRecordMapper.updateByList(list);
    }
}
